#include <iostream>
using namespace std;

const int N = 101;
int n;
int a[N], b[N];

int main()
{
    cin >> n;
    int cnt = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i] >> b[i];
        if(b[i] > a[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}